﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;



namespace PPTHelper.BLL
{
    public static  class ShapeGuideFormula
    {
        /// <summary>
        /// 先乘后除
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        static public double MultiplyDivide(double x, double y, double z)
        {
            return ((x * y) / z);
        }

        /// <summary>
        /// 先加后减
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        static public double AddSubtract(double x, double y, double z)
        {
            return ((x + y) - z);
        }

        /// <summary>
        /// 先加后除
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        static public double AddDivide(double x, double y, double z)  
        {
            return ((x + y) / z);
        }


        /// <summary>
        /// 根据X的值来选择y或者z
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        static public double IfElse(double x, double y, double z)
        {
            if (x > 0)
                return y;
            else
                return z;
        }

        /// <summary>
        /// 取绝对值
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        static public double AbsoluteValue(double x)
        {
            return Math.Abs(x);
        }

        /// <summary>
        /// ArcTant
        /// </summary>
        /// <param name="y"></param>
        /// <param name="x"></param>
        /// <returns></returns>
        static public double ArcTan(double y, double x)
        {
            return Math.Atan(y / x);
        }

        /// <summary>
        /// carct
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        static public double CosineArcTan(double x, double y, double z)
        {
            return x * Math.Cos(Math.Atan(z / y));
        }

        /// <summary>
        /// cos
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        static public double Cosine(double x, double y)
        {
            return x * Math.Cos(GetRadian(y));
        }

        /// <summary>
        /// 取最大值
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        static public double Maximum(double x, double y)
        {
            return x > y ? x : y;
        }

        static public double Minimum(double x, double y)
        {
            return x < y ? x : y;
        }

        static public double Modulo(double x, double y, double z)
        {
            return Math.Sqrt(x * x + y * y + z * z);
        }

        static public double PinTo(double x, double y, double z)
        {
            if (y < x)
            {
                return x;
            }
            else
            if (y > z)
            {
                return z;
            }
            else
            {
                return y;
            }
        }

        static public double SineArcTan(double x, double y, double z)
        {
            return x * Math.Sin(Math.Atan(z / y));
        }

        static public double Sine(double x, double y)
        {
            return x * Math.Sin(GetRadian(y));
        }

        static public double Sqrt(double x)
        {
            return Math.Sqrt(x);
        }

        static public double Tangent(double x, double y)
        {
            return x * Math.Tan(GetRadian(y));
        }

        static public double LiteralValue(double x)
        {
            return x;
        }

        /// <summary>
        /// ppt的角度转换为弧度
        /// </summary>
        /// <param name="value">ppt表示角度的值</param>
        /// <returns></returns>
        private static double GetRadian(double value)
        {
            var degree = value / 60000.0;
            var angle = degree * Math.PI / 180;
            return angle;
        }
    }
}
